package com.pes.arcww.form;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="QUESTIONS")
public class Questions implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="QUE_ID", unique = true)
	@GeneratedValue
	private Integer que_id;
	
	@Column(name="QUE_DESCRIPTION", length = 500)
	private String description;
	
	@Column(name="QUE_LEVEL")
	private Integer level;
	
	@Column(name="QUE_EXPLANATION", length = 500)
	private String explanation;
	
	@Column(name = "QUE_SECONDS")
	private Integer seconds;

	@Column(name = "QUE_POINTS")
	private Integer points;
	
	@Column(name= "QUE_ACTIVE")
	private boolean isActive;
	
	@Temporal(TemporalType.TIMESTAMP)
    @Column(name = "QUE_CREATEDDATE", nullable = false)
	private Date createdDate;

	@OneToMany(mappedBy = "question", orphanRemoval = true )
	private List<Items> itemsList = new ArrayList<Items>();
	
	@ManyToOne(fetch = FetchType.EAGER, optional=true)
	@JoinColumn(name = "TOP_ID_FK", nullable = false)
	private Topics topic;
	
	public void Question(){
		this.createdDate = new Date();
	}
	
	public Integer getId() {
		return que_id;
	}

	public void setId(Integer que_id) {
		this.que_id = que_id;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public String getExplanation() {
		return explanation;
	}

	public void setExplanation(String explanation) {
		this.explanation = explanation;
	}

	public Integer getSeconds() {
		return seconds;
	}

	public void setSeconds(Integer seconds) {
		this.seconds = seconds;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public Topics getTopic() {
		return topic;
	}

	public void setTopic(Topics topic) {
		this.topic = topic;
	}

	public List<Items> getItemsList() {
		return itemsList;
	}

	public void setItemsList(List<Items> itemsList) {
		this.itemsList = itemsList;
	}

	public Integer getPoints() {
		return points;
	}

	public void setPoints(Integer points) {
		this.points = points;
	}

	public boolean isActive() {
		return isActive;
	}

	public void setActive(boolean isActive) {
		this.isActive = isActive;
	}
}
